var roleGrantRightView = function(c, a, rights) {
	var b = new Ext.ux.TreeCheckPanel({
		id : "roleGrantView",
		checkModel : 'cascade', // 对树的级联多选
		onlyLeafCheckable : false,// 对树所有结点都可选
		autoScroll : true,
		rootVisible : false,
		animate : false,
		lines : true,
		loader : new Ext.ux.TreeCheckLoader({
					dataUrl : __ctxPath
							+ "/systemFunction/selectFunctionTreeMenu?isUnable=1",
					preloadChildren : true
				}),
		root : new Ext.tree.AsyncTreeNode({
					expanded : true
				}),
		tbar : [{
					xtype : "button",
					text : "展开",
					iconCls : "btn-expand",
					scope : this,
					handler : function() {
						b.expandAll();
					}
				}, {
					xtype : "tbseparator"
				}, {
					xtype : "button",
					text : "收起",
					iconCls : "btn-collapse",
					scope : this,
					handler : function() {
						b.collapseAll();
					}
				}, {
					xtype : "tbseparator"
				}, "->", {
					id : "refresh",
					xtype : "button",
					text : "刷新",
					iconCls : "btn-refresh",
					handler : function() {
						b.getRootNode().reload();
					}
				}]
	});
	b.expandAll();
	b.on('expandnode', function(node) {
				var tree = node.getOwnerTree();
				if (rights != null && rights.length > 0) {
					for (var i = 0, riLen = rights.length; i < riLen; i++) {
						if (node.id == rights[i]) {
							node.getUI().checkbox.checked = true;
							node.attributes.checked = true;
							tree.fireEvent('check', node, true);
						}
					}
				}
			});
	var d = new Ext.Window({
		id : "RoleGrantView",
		title : "为角色[" + a + "]授权",
		width : 500,
		height : 600,
		modal : true,
		layout : "fit",
		plain : true,
		items : [b],
		buttonAlign : "center",
		buttons : [{
			text : "保存",
			handler : function() {
				Ext.Ajax.request({
					url : __ctxPath + "/systemFunction/updateGrantRoleFunction",
					method : "POST",
					params : {
						roleId : c,
						rights : b.getValue().toString()
					},
					success : function(response, options) {
						var jsonData = Ext.util.JSON.decode(response.responseText);
						if (jsonData.success) {
							Ext.MessageBox.show({
										title : "信息提示",
										msg : "你已经成功为角色[<b>" + a + "</b>]进行了授权",
										buttons : Ext.MessageBox.OK,
										icon : Ext.MessageBox.INFO
									});
							d.close();
						} else {
							Ext.MessageBox.show({
										title : "错误提示",
										msg : jsonData.data,
										buttons : Ext.MessageBox.OK,
										icon : Ext.MessageBox.ERROR
									});
						}
					},
					failure : function(response, options) {
						Ext.MessageBox.show({
									title : "操作信息",
									msg : "服务器请求异常，请稍后再试!",
									buttons : Ext.MessageBox.OK,
									icon : Ext.MessageBox.ERROR
								});
					},
					scope : this
				});
			}
		}, {
			xtype : "tbseparator"
		}, {
			text : "取消",
			handler : function() {
				d.close();
			}
		}]
	});
	return d;
};